/**
 * 模型配置文件
 * 集中管理所有模型文件的URL配置
 */

export interface ModelConfig {
  id: string;
  name: string;
  url: string;
  type: 'glb' | 'gltf' | 'hdr';
  priority: 'high' | 'medium' | 'low';
  size?: number; // 文件大小（字节）
  description?: string;
}

// 基础模型配置
export const BASE_MODELS: ModelConfig[] = [
  {
    id: 'default-human',
    name: '默认数字人',
    url: 'https://aiimg.huilan.com/material/model/bucket-000000/1770991377771941889.glb',
    type: 'glb',
    priority: 'high',
    size: 15728640, // 15MB
    description: '默认数字人模型'
  },
  {
    id: 'female-human-1',
    name: '女性数字人1',
    url: 'https://aiimg.huilan.com/material/model/bucket-000000/1845686477328011266.glb',
    type: 'glb',
    priority: 'high',
    size: 16777216, // 16MB
    description: '女性数字人模型'
  },
  {
    id: 'male-human-1',
    name: '男性数字人1',
    url: 'https://aiimg.huilan.com/material/model/bucket-000000/1845663967643488257.glb',
    type: 'glb',
    priority: 'high',
    size: 14680064, // 14MB
    description: '男性数字人模型'
  }
];

// 环境贴图配置
export const ENVIRONMENT_MAPS: ModelConfig[] = [
  {
    id: 'studio-environment',
    name: '工作室环境',
    url: 'innerPages/commonAssets/texture/equirectangular/studio_small_09_1k.hdr',
    type: 'hdr',
    priority: 'medium',
    size: 1048576, // 1MB
    description: '工作室环境光照贴图'
  }
];

// 动作模型配置
export const ACTION_MODELS: ModelConfig[] = [
  {
    id: 'idle-animation',
    name: '待机动画',
    url: 'https://aiimg.huilan.com/material/model/bucket-000000/idle.glb',
    type: 'glb',
    priority: 'medium',
    size: 2097152, // 2MB
    description: '待机动画模型'
  },
  {
    id: 'walk-animation',
    name: '行走动画',
    url: 'https://aiimg.huilan.com/material/model/bucket-000000/walk.glb',
    type: 'glb',
    priority: 'medium',
    size: 3145728, // 3MB
    description: '行走动画模型'
  },
  {
    id: 'talk-animation',
    name: '说话动画',
    url: 'https://aiimg.huilan.com/material/model/bucket-000000/talk.glb',
    type: 'glb',
    priority: 'medium',
    size: 2621440, // 2.5MB
    description: '说话动画模型'
  }
];

// 获取项目对应的模型URL
export const getModelUrlByProjectId = (projectId: string): string => {
  const urlMap: Record<string, string> = {
    '1805122630329040898': 'https://aiimg.huilan.com/material/model/bucket-000000/1845686477328011266.glb',
    '1803245434144567297': 'https://aiimg.huilan.com/material/model/bucket-000000/1845663967643488257.glb',
    'default': 'https://aiimg.huilan.com/material/model/bucket-000000/1770991377771941889.glb'
  };
  
  return urlMap[projectId] || urlMap.default;
};

// 获取所有需要预加载的模型
export const getPreloadModels = (): string[] = {
  return [
    ...BASE_MODELS.map(model => model.url),
    ...ENVIRONMENT_MAPS.map(model => model.url),
    ...ACTION_MODELS.map(model => model.url)
  ];
};

// 根据优先级获取模型列表
export const getModelsByPriority = (priority: 'high' | 'medium' | 'low'): ModelConfig[] = {
  return [
    ...BASE_MODELS,
    ...ENVIRONMENT_MAPS,
    ...ACTION_MODELS
  ].filter(model => model.priority === priority);
};